#include <bits/stdc++.h>

using namespace std;


int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,i,j,a[10010],g=0,h=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
        if(a[i]==1)g++;
        if(a[i]==2)h++;
    }
    int s=g+h;
    if(s==n){
        if(g<=h)cout<<h;
        else cout<<g;
    return 0;
}
